<?php
//css
echo $this->Html->css(array('jquery-ui-1.8.15.custom'), false);
//plugins
 echo $this->Html->script(array('plugins/jquery-ui-1.8.15.custom.min'), false);
$this->Html->scriptStart(array('inline' => false));

echo '
      $(function(){
         $("#printBtn").button().click(function(){window.print();});
      });
       ';
$this->Html->scriptEnd();
?>
<?php
  $companyDetails = $couponInfo['Company']['name'];
  if(!empty($couponInfo['Company']['address'])){$companyDetails .= "<br/>".$couponInfo['Company']['address'];}
  if(!empty($couponInfo['Company']['phone'])){$companyDetails .= "<br/>".$couponInfo['Company']['phone'];}
  if(!empty($couponInfo['Company']['phone_additional'])){$companyDetails .= "<br/>".$couponInfo['Company']['phone_additional'];}
  if(!empty($couponInfo['Company']['email'])){$companyDetails .= "<br/>".$couponInfo['Company']['email'];}
  if(!empty($couponInfo['Company']['url'])){$companyDetails .= "<br/>".$couponInfo['Company']['url'];}
  $validStartDate = new DateTime($couponInfo['Coupon']['valid_start_date']);
  $validEndDate = new DateTime($couponInfo['Coupon']['valid_end_date']);
  $couponImage = !empty($couponInfo['Coupon']['image_path']) ? $couponInfo['Coupon']['image_path'] :  "";
  if (empty($couponImage)){ $couponImage =  $couponInfo['Company']['image_path'];}
?>
<div id="couponContainer">
  <div id="couponCompany"><?php echo $couponInfo['Company']['name'];?></div>
  <div id="couponValidPeriod"><span id="couponText">BONUS COUPON</span><span id="couponDates">Valid: <?php echo $validStartDate->format('l, M j Y');?>, through <?php echo $validEndDate->format('l, M j Y');?></span></div>
  <div id="couponCompanyDetails"><?php echo $companyDetails;?></div>
  <div id="couponCompanyLogo"><?php if(!empty($couponImage)) { echo $this->Html->image($couponImage, array('alt' => $couponInfo['Coupon']['title']));} ;?></div>
  <div id="couponTitle"><?php echo $couponInfo['Coupon']['title'];?></div>
  <?php //separator ?>
  <hr/>
  <div id="couponDescription"><?php echo $couponInfo['Coupon']['description'];?></div>
  <div id="couponSponsorDetails">Coupon offered at IsleVow.com <br/>http://www.islevow.com<br/>info@islevow.com</div>
  <div id="couponSponsor"><?php echo $this->Html->image('header-logo.png', array('alt' => 'Isle Vow'));?></div>
</div>

<div id="printCouponButton"><button id="printBtn" name="printBtn" >Print Coupon</button></div>
